1. Field of the Invention
The present invention relates to imaging, and, more particularly, to a method and system for enhancing an image.
2. Description of the Related Art
Many standard image-processing techniques have been developed to enhance image data. The original images may be, for example, digital photographs, scanned data, or documents created on a computer. The primary techniques used are contrast stretching, Tone Response Curves (TRC) and spatial filters. Other techniques, such as unsharp masking, erosion and dilation, can also be used. Each of these techniques has parameters that control how image data is affected. Different types of images require different parameter values in order to achieve optimal improvement.
Contrast stretching is a technique which generally uses a piecewise linear transformation to convert the input data to adjusted output values. The adjustments are typically separated into regions, for example, three regions, such as a dark region, a mid-tone region, and light region. Parameters for each region include the range of input values for the particular region, as well as parameters specific to the transfer function used for the particular region. The input values are transformed according to the definitions for each region. Another way to parameterize the function would be to specify the transition points.
Tone response curves (TRC) refer to implementing a more complicated transform of the image data. A look up table is generally used to implement TRCs. A curve that has the desired shape is digitized and stored in a Look Up Table (LUT). The input data is transformed by looking up the appropriate value in the LUT. The LUT may have an entry for each input value, or it may be a sparse LUT that stores a subset of the values, and uses interpolation to approximate the intermediate values. A LUT can be used to implement a power curve, a polynomial expression, an arbitrary curve or even contrast stretching.
Spatial filters use information about neighboring pixels to modify pixel values. Median filters, sharpening filters and linear spatial filters (convolution kernel) are examples of spatial filters. The median filter is an order-statistic filter which sorts the values of the pixel and its neighbors and uses the median value as output. A convolution kernel uses a mask, which applies weights to the pixel and its neighbors and adds them together. The resultant value is used as the output. A parameter for a median filter includes the size of the neighborhood to use. Parameters for a convolution kernel include the size of the mask and the values contained in the mask (weights).